<template>
	<navbar title="线上课程" :isBack="true"></navbar>
	<view class="page" v-if="List.length > 0">
		<!-- <u-tabs :list="tabsList" :is-scroll="true" v-model="current" @change="tabsChange" active-color="#3F4780"
			bg-color="#F8F8F9"></u-tabs> -->
		<view class="" style="padding:   30rpx;">
			<item @detail="detail" :List="List"></item>
		</view>
	</view>
<view  v-else>
		<nodata></nodata>
	</view>
</template>

<script setup lang="ts">
	import { ref, reactive } from 'vue'
	import item from './item.vue'
	import { Course } from '@/service/api/index'
	import tools from '@/utils/tools'
	import nodata from '@/components/nodata.vue'
	import { onLoad ,onShareAppMessage} from '@dcloudio/uni-app'
	// const tabsList = ref([
	// 	{ name: '全部' },
	// 	{ name: '新手入门' },
	// 	{ name: '初级进阶' },
	// 	{ name: '能力巩固' },
	// 	{ name: '能力进阶' },
	// ])
	// const current = ref(0)
	// const tabsChange = (index : number) => {
	// 	console.log(index);
	// }

	const List = ref<Array<ListType>>([{
		id: 0,
		classify_id: 0,//分类id
		image: "",
		name: "",
		introduce: "", //介绍
		price: "",
		detail: "",
		state: "",
		create_time: 0

	}])
	onLoad(() => {
		getData()
	})
		
	// onShareAppMessage((options:ShareAppMessageOption)=>{
	// 	console.log(options);
	// })
	const getData = async () => {
		const res = await Course("");
		List.value = res.msg.data;
		console.log(res.msg.data);
	}

	const detail = (id:number) => {
		tools.navTo('/pagesB/course/detail?id=' + id);
	}
</script>

<style scoped lang="scss">
	.page {
		min-height: calc(100vh - 68px);

		// background-color: #F8F8F9;
	}

	:deep(.u-tab-item) {
		color: black !important;
		font-size: 32rpx !important;
	}
</style>